package com.qd.common.panda.domain.enums;

import lombok.Getter;
import org.springframework.util.StringUtils;

/**
 * 加油站公司名称
 * 只有壳牌(小铁)和易加油
 *
 * @author sjk
 */
@Getter
public enum GasStationCompanyNameEnum {
    /**
     *
     */
    EXTEND_SHELL("EXTEND_SHELL", "延长壳牌普通"),
    EXTEND_SHELL_HIGH("EXTEND_SHELL_HIGH", "延长壳牌高速"),
    EXTEND_SHELL_OTHER("EXTEND_OTHER", "延长壳牌民营"),
    E_JIA_YOU("E_JIA_YOU", "易加油");

    /**
     * 编号
     */
    final String code;
    /**
     * 值
     */
    final String msg;

    GasStationCompanyNameEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static String idToDisplay(String code) {
        String msg = "";
        if (StringUtils.hasLength(code)) {
            for (GasStationCompanyNameEnum gasStationCompanyNameEnum : values()) {
                if (gasStationCompanyNameEnum.getCode().equals(code)) {
                    msg = gasStationCompanyNameEnum.getMsg();
                }
            }
        }
        return msg;
    }

    public static String displayToId(String displayName) {
        String code = "";
        if (StringUtils.hasLength(displayName)) {
            for (GasStationCompanyNameEnum gasStationCompanyNameEnum : values()) {
                if (gasStationCompanyNameEnum.getMsg().equals(displayName)) {
                    code = gasStationCompanyNameEnum.getCode();
                }
            }
        }
        return code;
    }
}